﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Domain.Entities.Auditing;

namespace XuZhou.SmartWaterConservancy.HeHu.Waters
{
    public class WaterStationBase : FullAuditedAggregateRoot<Guid>
    {
        /// <summary>
        /// 站点编码
        /// </summary>
        public string Code { get; protected set; }

        /// <summary>
        /// 站点名称
        /// </summary>
        public string Name { get; protected set; }

        /// <summary>
        /// 站点类型
        /// </summary>
        public WaterStationType StationType { get; protected set; }

        /// <summary>
        /// 行政区划编码
        /// </summary>
        public string AdministrativeDivisionCode { get; protected set; }

        /// <summary>
        /// 经度
        /// </summary>
        public double Longitude { get; protected set; }

        /// <summary>
        /// 纬度
        /// </summary>
        public double Latitude { get; protected set; }

        /// <summary>
        /// 站点分类ID
        /// </summary>
        public Guid? CategoryId { get; protected set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; protected set; }

        protected WaterStationBase() { }

        protected WaterStationBase(
            Guid id,
            string code,
            string name,
            WaterStationType stationType,
            string administrativeDivisionCode,
            double longitude,
            double latitude,
            Guid? category = null,
            string remark = null) : base(id)
        {
            Check.NotNullOrWhiteSpace(code, nameof(code));
            Check.NotNullOrWhiteSpace(name, nameof(name));

            Code = code;
            Name = name;
            StationType = stationType;
            AdministrativeDivisionCode = administrativeDivisionCode;
            Longitude = longitude;
            Latitude = latitude;
            CategoryId = category;
            Remark = remark;
        }

        /// <summary>
        /// 更新站点基本信息
        /// </summary>
        public void UpdateBasicInfo(
            string name,
            string administrativeDivisionCode,
            double longitude,
            double latitude,
            string remark = null)
        {
            Check.NotNullOrWhiteSpace(name, nameof(name));

            Name = name;
            AdministrativeDivisionCode = administrativeDivisionCode;
            Longitude = longitude;
            Latitude = latitude;
            CategoryId = categoryId;
            Remark = remark;
        }
    }
}
